﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Answers.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta charset="utf-8" />
    <!--#include virtual="include/Head.ascx"-->

    <script type="text/javascript" language="javascript">
        function doDelete(strID, strType) {
            if (confirm('Bạn có thực sự muốn xóa!')) {
                var vnpage = getUrlVars()['page_number'];
                if (vnpage)
                    window.location.href = "Answers.aspx?action=delete&ID=" + strID + "&page_number=" + vnpage;
                else
                    window.location.href = "Answers.aspx?action=delete&ID=" + strID;
            }
        }
         function doEdit(strID){   
            var vnpage = getUrlVars()['page_number'];   
            if(vnpage)      
                url = "Answers.Edit.aspx?id=" + strID+ "&page_number=" + vnpage;            
            else
                url = "Answers.Edit.aspx?id=" + strID; 
                window.open(url, 'AskAnswer', 'width=800,height=600,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');       
            //var win=window.open(url, '_blank');
            //win.focus();
        }
        function openAskAdd() {
           
            var url = 'Answers.Edit.aspx';            
            window.open(url, 'ASKADD', 'width=800,height=600,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
        }
        $(document).ready(function () {
            $("li").click(function () {
                //$(".detail").hide();
                if ($(this).attr("class") != "active") {
                    $(".detail").css("display", "none");
                    $("td div li").removeClass("active");
                }
                $(this).toggleClass("active");
                $(this).next("div").stop('true', 'true').slideToggle("slow");
            });
        });	             
        $(document).ready(function() {
            //$('#search-button').on("click",function() {
                if(!searchAndHighlight($('#txtkeyword').val(), "#divContent")) {
                    //alert("No results found");
                }
                else
                {
                    $("td div li").addClass("active");
                }
                
            //});
//             var searchTerm = $('#txtkeyword').val().toLowerCase();
//            $(".content-box").filter(function() {
//            return $(this).text().toLowerCase().indexOf(searchTerm) > -1;
//            }).addClass('highlighted');
        });
        
    </script>

    <style type="text/css"> 
        .highlighted {
             background-color:yellow;
        }
        td div li:hover{background:#FFFFE0}
		td div li{list-style-type:none; cursor:pointer; -moz-border-radius:0 10px 0 10px; border:0px solid #666666; margin:2px; padding:5px 5px 5px 5px;}
		td div li p{display:inline;}
		td div li div:hover{text-decoration:none !important;}
		td div li:before {content: "   ";background:url("/Assets/images/icon-jquery.png") -52px 7px no-repeat; padding:5px 10px 5px 5px; color:red; font-weight:bold;}
		td div li.active:before {content: ""; background:url("/Assets/images/icon-jquery.png") -52px -11px no-repeat;font-size:11px;font-weight:bold;padding:5px 10px 5px 5px; color:red; font-weight:bold;}   		 
		td div div{color: #666666;font-size:12px;background-color:azure;border-radius: 10px;
        border: 1px solid; cursor: auto; display: none; font-size: 13px; padding: 5px 0 5px 20px; text-decoration: none; }
        td.has-value, td.has-value input
        {
	        color: #0000ff;
        }
    </style>
</head>
<body>
    <div id="body-wrapper">
        <div id="header">
            <!--#include virtual="include/top.ascx"-->
        </div>
        <div id="main-content1">
            <h2>
                CÂU HỎI HỆ THỐNG</h2>
            <div class="clear">
            </div>
            <div class="content-box">
                <form id="frmCarrContact" runat="server">
                    <div class="content-box-header">
                        <%--<h3 style="cursor: s-resize;">
                            Câu hỏi hệ thống</h3>--%>
                        <%if (nPermissions > 3){%>
                        <a class="button" href="#" onclick="openAskAdd();" style="margin: 10px 10px; float: right;">
                            Add New </a>
                        <%} %>
                        <div style="padding: 10px;">
                            Find:<asp:TextBox ID="txtkeyword" Text="" runat="server" Width="400px"></asp:TextBox>
                            &nbsp;<asp:Button ID="btnSearch" runat="server" Text="&nbsp;Seach&nbsp;" CssClass="button"
                                OnClick="btnSearch_Click" />
                        </div>
                        <div class="clear">
                        </div>
                    </div>
                    <div id="divContent">
                        <asp:Repeater runat="server" ID="rptData">
                            <ItemTemplate>
                                <tr onmouseover="this.style.background='#dbf0c9'" onmouseout="this.style.background='#ffffff'">
                                    <td style="width: 50px;">
                                        <%#Eval("Index") %>
                                    </td>
                                    <td>
                                        <div>
                                            <li>
                                               <%#HttpUtility.HtmlDecode(Eval("Summary").ToString()) %>
                                            </li>
                                            <div <%=strDisplay%> class="detail">
                                               <%#HttpUtility.HtmlDecode(Eval("Detail").ToString()) %>
                                            </div>
                                        </div>
                                    </td>
                                    <td style="width: 70px;">
                                        <%#Eval("AskName").ToString()%>
                                    </td>
                                    <td style="width: 70px;">
                                        <%#Eval("AnswerName").ToString()%>
                                    </td>
                                    <td style="width: 70px;" class="has-value">
                                        <%#Eval("LastUpdate").ToString()%>
                                    </td>
                                    <td style="width: 70px;">
                                        <%#Eval("Action").ToString()%>
                                    </td>
                                </tr>
                            </ItemTemplate>
                            <HeaderTemplate>
                                <table cellspacing="0" cellpadding="0" width="100%" border="0" class="adminlist">
                                    <thead>
                                        <tr>
                                            <td>
                                                STT</td>
                                            <td>
                                                Nội dung Hỏi - Đáp</td>
                                            <td>
                                                Người hỏi</td>
                                            <td>
                                                Người trả lời</td>
                                            <td>
                                                Update</td>
                                            <td>
                                                Action</td>
                                        </tr>
                                    </thead>
                            </HeaderTemplate>
                            <FooterTemplate>
                                </TABLE>
                            </FooterTemplate>
                        </asp:Repeater>
                    </div>
                    <div class="clear">
                    </div>
                    <div id="footer">
                        <%=strPager%>
                    </div>
                </form>
            </div>
        </div>
    </div>
</body>
</html>
